﻿@{
    ViewBag.Title = "库存预警";
}
@section scripts
{   
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <script src="@Url.Content("~/Scripts/shared/shown.js")" type="text/javascript"></script>  
    <script src="@Url.Content("~/Scripts/common/export.js")" type="text/javascript"></script>
}
<body>
   <form id="form1" runat="server" method="post" style="height: 100%">
    
    @Html.Partial("~/Views/Modular/ReportsToolbar.cshtml")
    
    <div id = "DivHeader">
        <table>
            <tr>
                <td width ="70px" align="right">门店名称：</td>
                <td width ="190px">    
                    @Html.Partial("~/Views/Modular/LookupStockInfo.cshtml")                      
                </td>
                <td width ="70px" align="right">预警状态：</td>
                <td width ="150px">
                    <input id="mType" name ="mType" class="mini-combobox" style="width:150px;" 
                    showNullItem="false" required="true" allowInput="false" align="left" value="0" data ="warnState"/>  
                </td>
           </tr>
        </table>
    </div>
    <div class="mini-fit">
        <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" borderStyle="border:1;" pageSize="15"
            url="../Report/GetCommonReport" multiSelect="true"
            allowCellSelect="true" allowCellEdit="true" showSummaryRow="true"
            fitColumns="false" onrowdblclick="editBill" sortMode="client">
            <div property="columns">
                <div type="checkcolumn" ></div>
                <div field="FCode" width="110" headerAlign="center">商品条码</div>
                <div field="FGoodName" width="200" headerAlign="center">商品名称</div>
                <div field="FSpec" width="100" headerAlign="center">商品规格</div>
                <div field="FUnitName" width="60" headerAlign="center">单位</div>
                <div field="FQty" name="FQty" width="100" headerAlign="center"align="right"numberFormat="#,0.00">库存数量</div>
                <div field="FLowLimit" name="FQty" width="100" headerAlign="center"align="right"numberFormat="#,0.00">最低库存</div>
                <div field="FHightLimit" name="FQty" width="100" headerAlign="center"align="right"numberFormat="#,0.00">最高库存</div>
                <div field="mTypes" width="100" headerAlign="center">预警状态</div>
                <div field="FCorpName" width="100" headerAlign="center">商户名称</div>
                <div field="FStockName" width="100" headerAlign="center">门店名称</div>
            </div>
        </div>  
    </div>
    
    <script type="text/javascript">
        var warnState = [{ "id": "0", "text": "低于最低库存" },
                 { "id": "1", "text": "高于最高库存" }];

        mini.parse();
        var form = new mini.Form("form1");
        var grid = mini.get("datagrid1");
        var uID = parent.window.getSystemAppID();

        function FormShown() {
            LoadData();
        }


        function clearloca() {
            mini.getbyName("FStockID").setValue("");
            mini.getbyName("FStockID").setText("");
            mini.getbyName("FStockName").setValue("");
        }

        function LoadData() {
            var mStockID = mini.getbyName("FStockID").getValue();
            var mType = mini.getbyName("mType").getValue();

            var json = "[{";
            json = json + '"mReportType":' + '"7001",';//列表类型
            json = json + '"mSystemAppID":' + '"' + uID + '",';
            json = json + '"mStockID":' + '"' + mStockID + '",';
            json = json + '"mType":' + mType ;
            json = json + "}]";

            grid.load({ mydata: json });

            mExportDataUrl = grid.url;
            mExportDataJson = json;//导出
        }

        function printdata() {
            var url = "../Report/PrintReport";
            mini.open({
                url: url,
                title: "打印", width: 1000, height: 700,
                onload: function () {
                    var iframe = this.getIFrameEl();
                    var NoneDisplayCol = [0];
                    iframe.contentWindow.InitalPrint(grid, NoneDisplayCol, parent.window.getSystemCompany() + "库存预警表");
                }
            });
        }

        function sendData() {
            var rows = grid.getSelecteds();
            var datastr = JSON.stringify(rows);
            $.post("../Report/setData", { data: datastr }, function (data) {
                window.parent.showTabByIdEx('119','DeliveryRmo', '直营配送', '../Delivery/deliveryRmo?datatype=20&billid=0');
            });
        }

    </script>

    </form>
</body>